<template>
	<view class="historyUpdate">
		<view class="Card padd40" v-for="i in data_list" :key="i._id">
			<view class="card-hd paddtb20 font-wei600 fo-34">({{i.Version}})   {{ $tool.formatDate(new Date(i.createTime), 'YYYYMMMDDHHMMSS') }}</view>
			<text class="card-content" selectable="true">{{ i.content }}</text>
		</view>

		<!-- 加载更多 -->
		<u-loadmore class="padd20" :status="LoadMoreStatus" icon-type="flower" />
	</view>
</template>

<script>
import { API$SelUpdateList } from '../../../common/API/home.js';
export default {
	name: '',
	data() {
		return {
			data_list: [], // 后端数据
			total: '', // 数据库的所有数据长度
			LoadMoreStatus: 'loadmore',
			SelJson: {
				pageSize: 10,
				pageNum: 0
			}
		};
	},
	onLoad() {
		this.getList();
	},
	onReachBottom() {
		this.LoadMoreStatus = 'loading';
		if (this.SelJson.pageNum + 1 > Math.floor(this.total / this.SelJson.pageSize)) return (this.LoadMoreStatus = 'nomore');
		this.SelJson.pageNum++;
		this.getList();
	},
	methods: {
		async getList() {
			let { code, msg, data, total } = await API$SelUpdateList(this.SelJson);
			console.log(code, msg, data);
			if (code === 200) {
				this.total = total;
				this.data_list = this.data_list.concat(data);
			}
		}
	}
};
</script>

<style scoped lang="less">
.Card {
	border-bottom: 1px solid #f1f1f1;
}
.card-hd {
	position: relative;
	text-indent: 30rpx;
	margin-left: -20rpx;
	line-height: 20rpx;
}
.card-hd::after {
	position: absolute;
	top: 50%;
	left: 0;
	transform: translate3d(0, -50%, 0);
	content: '';
	height: 40rpx;
	width: 10rpx;
	background-color: red;
}
.card-content {
	line-height: 80rpx;
}
</style>
